MAX = 1000001
f = {}

def find(n):
    if f.get(n, 0):
        return f[n]
    if n % 2 == 0:
        f[n] = 1 + find(n / 2)
    else:
        f[n] = 1 + find(3 * n + 1)
    return f[n]

f[1] = 1

ans = 1
count = 1

for i in xrange(1, MAX):
    temp = find(i)
    if count < temp:
        count = temp
        ans = i
print ans

